﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Shrestha.Trigraph
{
    /// <summary>
    /// Interaction logic for TriGraphBreadCrumb.xaml
    /// </summary>
    public partial class TriGraphBreadCrumb : Window
    {
        public WorkingSet Result { get; private set; }

        public TriGraphBreadCrumb(WorkingSet ws)
        {
            InitializeComponent();
            this.Result = ws;
            this.comboBoxRows.ItemsSource = TriGraphResources.rowNames;
        }

        private void buttonCreate_Click(object sender, RoutedEventArgs e)
        {
            string[] strs = textSearchString.Text.Split(',');
            string searchBase = comboBoxRows.SelectedValue.ToString();

            try
            {
                Filter.GetCrumbSets(searchBase, strs, Result);
                this.DialogResult = true;
            }
            catch
            {
                MessageBox.Show("Error: Please enter valid range for the filters");
                this.DialogResult = false;
            }

        }

        private void buttonCancel_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
